import time
def logger(path):
    def log(func):
        def inner(*args,**kwargs):
            ret=func(*args,**kwargs)
            with open(path,mode='a',encoding='utf-8') as f:
                msg=f'{time.strftime("%Y-%m-%d %H:%M:%S")}执行了{func.__name__}\n'
                f.write(msg)
            return ret
        return inner
    return log
#先执行logger('')函数,返回log-->@log-->login=log(login)=inner
@logger('auth.log')    #log('auth.log')=ret,-->@ret-->login=ret(login)
def login():
    print('登录的逻辑')

@logger('auth.log')
def register():
    print('注册的逻辑')

@logger('operate.log')
def show_goods():
    print('查看所有的商品信息')

@logger('operate.log')
def add_godds():
    print('加入购物车')




